using System.Collections.Generic;

namespace RoMBot.Classes
{
    public class Equipment
    {
        public readonly List<EquipmentItem> BagSlot = new List<EquipmentItem>();

        public Equipment()
        {
            for ( var i = 1; i <= 21; i++ )
            {
                BagSlot.Add( new EquipmentItem( i ) );
            }
        }

        public void Update()
        {
            foreach ( var equip in BagSlot )
            {
                equip.Update();
            }
        }

        public int AmmunitionCount
        {
            get
            {
                BagSlot[ 8 ].Update();
                return BagSlot[ 8 ].ItemCount;
            }
        }

        public int GetDurability( int slot = 15 )//15 = MainHand, 16 = OffHand
        {
            BagSlot[ slot - 1 ].Update();

            return ( int ) ( this.BagSlot[ slot - 1 ].Durability / this.BagSlot[ slot - 1 ].MaxDurability * 100f );
        }

        public int MainHandDurability
        {
            get { return GetDurability(); }
        }
    }
}
